/*
 * @Author: kkk 997610780@qq.com
 * @Date: 2025-01-09 19:10:53
 * @LastEditors: kkk 997610780@qq.com
 * @LastEditTime: 2025-03-29 16:12:35
 * @FilePath: \knowledge-uni\src\service\course\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { http } from '@/utils/http'

// 获取课程分类
export const fetchCourseCategor = () => http.get('/shopapi/goodsCategory/lists')

// 获取课程列表
export const fetchCourseList = <D>(query: D) => http.get('/shopapi/goods/lists', query)

// 获取课程详情
export const fetchCourseDetail = <D>(data: D) => http.get('/shopapi/goods/detail', data)

// 保存视频进度
export const fetchSchedule = (data: { id: string; watch: number }) =>
  http.post('/shopapi/order/watchSchedule', data)

// 获取课程目录
export const fetchCourseMenu = (category_id: string) =>
  http.get('/shopapi/goods/listings', { category_id })

// 优惠券列表
export const fetchCouponList = () => http.get('/shopapi/coupon/lists')

export const fetchGetCoupon = <D>(data: D) => http.post('/shopapi/coupon/receive', data)

// 收藏课程
export const collectCourse = (id: string) =>
  http.post('/shopapi/collect/handleCollectgoods', { id })
